package nioTest.com.io;

import java.nio.ByteBuffer;

/**
 * @author      : yang.xp
 * @date        : 2022/3/14 0014 20:30
 * @description : put 与 get的方法要对应
 */
public class NIOByteBufferPutGet {

    public static void main(String[] args) {
        ByteBuffer allocate = ByteBuffer.allocate(64);
        allocate.putInt(10);
        allocate.putLong(100);

        allocate.flip();

        int anInt = allocate.getInt();
        long aaInt = allocate.getLong();

        System.out.println(anInt + " " + aaInt);
//        将buffer 指定为只读
//        allocate.asReadOnlyBuffer();
    }
}
